VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsObject"
Attribute VB_GlobalNameSpace = True
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'xwelx 04.2010

Option Explicit

Public Sub MoveCombo(cbo As Object, dtg As Object, gcol As MSDataGridLib.Column)
On Error GoTo error_handler
    
    cbo.Visible = True
    
    Set gcol = dtg.Columns(dtg.Col)
    
    ' Move the ComboBox
    cbo.Move dtg.Left + gcol.Left, _
        dtg.Top + dtg.RowTop(dtg.Row), gcol.Width
    cbo.ZOrder
    cbo.Text = gcol.Text
    cbo.SetFocus
    Exit Sub

error_handler:
    Resume Next
End Sub

Public Sub MoveText(txt As Object, dtg As Object, gcol As MSDataGridLib.Column)
On Error GoTo error_handler
Dim nTop
    
    txt.Visible = True
    
    Set gcol = dtg.Columns(dtg.Col)
    
    If (dtg.Height - (dtg.Top + dtg.RowTop(dtg.Row))) > (txt.Height - dtg.Top) Then
        nTop = (dtg.Top + dtg.RowTop(dtg.Row) + dtg.RowHeight)
    Else: nTop = (dtg.Top + dtg.RowTop(dtg.Row)) - txt.Height
    End If
    
    ' Move the textbox
    txt.Move dtg.Left + gcol.Left, nTop
    txt.ZOrder
    txt.Text = gcol.Text
    txt.SetFocus
    Exit Sub

error_handler:
    Resume Next
End Sub

'Combo box value upon startup/initialization
Public Sub ComboLoadValue(cbo As Object, strValue As String)
On Error GoTo error_handler
    If Trim(strValue) <> "" Then
        cbo = Trim(strValue)
    Else
        cbo.ListIndex = 0
    End If
error_handler:
    If Err.Number = 383 Then
        Resume Next
    End If
End Sub

'Sorts recordset
Public Sub SortGrid(dtg As Object, ColIndex As Integer, rsT As Recordset)
Dim strDTFld As String
    
    strDTFld = dtg.Columns(ColIndex).DataField
    
    If rsT.Sort = strDTFld & " ASC" Then
        rsT.Sort = strDTFld & " DESC"
    Else: rsT.Sort = strDTFld & " ASC"
    End If

End Sub

Public Sub FormCenter(frm As Object, Optional frmMDI As Variant)

    'Syntax:
    'Center Form1, [MDIForm1]
    Dim ret As Boolean
    ret = IsMissing(frmMDI)

    If ret = False Then
        frm.Top = (frmMDI.ScaleHeight - frm.Height) / 2
        frm.Left = (frmMDI.ScaleWidth - frm.Width) / 2
    Else
        frm.Top = (Screen.Height - frm.Height) / 2
        frm.Left = (Screen.Width - frm.Width) / 2
    End If
End Sub
Public Sub FormWaitHide()
    Unload frmWait
End Sub

'Show waiting form
Public Sub FormWaitShow(AnimationPath As String, Msg As String, Optional bval As Boolean)
On Error GoTo TheSource

    frmWait.sPath = AnimationPath
    frmWait.ITGLabel1.Caption = Msg '"Loading data. . ."
    frmWait.ITGLabel3.Visible = bval
    frmWait.ITGLabel4.Visible = bval
    frmWait.Height = 2200
    Load frmWait
    frmWait.Show
    DoEvents
TheSource:
    Resume Next
End Sub






